import 'package:flutter/material.dart';
import 'appbar_tab.dart';
import '../style/text.dart';
import '../style/color.dart';

// 顶部标签栏组合
TabBar buildAppbarTabbar(
    {List<String> strList,
    TabController tabController,
    EdgeInsetsGeometry tabPadding,
    TextStyle selectedStyle,
    TextStyle unselectedStyle,
    EdgeInsetsGeometry tabMargin}) {
  return TabBar(
    controller: tabController,
    isScrollable: true, // 可滚动
    labelStyle: selectedStyle ?? tabHightlightStyle, // 未选中文字样式
    unselectedLabelStyle: const TextStyle(fontWeight: FontWeight.w400),
    labelColor: mainThemeColor,
    unselectedLabelColor: grayTextColor,
    indicatorColor: mainThemeColor, // 指示线样式
    labelPadding: EdgeInsets.all(0), // 无边距
    indicatorPadding: kTabLabelPadding,
    tabs: [
      for (String str in strList)
        AppBarTab(
          text: str,
          padding: tabPadding,
          margin: tabMargin,
        )
    ],
  );
}
